package com.boyunv.command.example01;
/*
 *@description
 *  具体命令
 *@author boyunv
 *@create 2023/9/7 7:32
 *@version 1.0
 */

import java.util.Set;

public class OrderCommand implements Command{
    
    //接受者对象引用
    private Chef receiver;
    
    private Order order;
    
    public OrderCommand(Chef receiver, Order order) {
        this.receiver = receiver;
        this.order = order;
    }
    
    @Override
    public void execute() throws InterruptedException {
        System.out.println(order.getDiningTable()+"桌的订单");
        
        Set<String> menuKey = order.getFoodMenu().keySet();
        for (String menu : menuKey) {
            receiver.makeFood(order.getFoodMenu().get(menu),menu);
        }
        
        Thread.sleep(1000);
        System.out.println(order.getDiningTable()+"桌的菜品已经上齐");
    }
}
